package config_manager

import (
	"go_server/game_server/dataconfig/configpb"
	"go_server/zinx/zlog"
)

// 根据奖池类型获取奖池配置
func GetStcTableHeroDraw_SheetDrawById(id int32) (configpb.StcTableHeroDraw_SheetDraw_F6601B8C, bool) {
	config, ok := tableHeroDrawSheetDraw[id]
	if !ok {
		zlog.Errorf("GetStcTableTask_SheetTask Err!!! id: %d", id)
		return configpb.StcTableHeroDraw_SheetDraw_F6601B8C{}, false
	}

	return configpb.StcTableHeroDraw_SheetDraw_F6601B8C{
		Id:        config.Id,
		Type:      config.Type,
		Time:      config.Time,
		Consume:   config.Consume,
		Firstdraw: config.Firstdraw,
		FreeNum:   config.FreeNum,
		DrawMax:   config.DrawMax,
	}, true
}

// 获取奖池配置列表
func GetStcTableHeroDraw_SheetDrawList() map[int32]*configpb.StcTableHeroDraw_SheetDraw_F6601B8C {
	return tableHeroDrawSheetDraw
}

// 根据奖池类型获取奖池配置列表
func GetStcTableHeroDraw_SheetDrawItemListByType(summomType int32) map[int32]*configpb.StcTableHeroDraw_SheetDrawItem_7602FC84 {
	allConfig := make(map[int32]*configpb.StcTableHeroDraw_SheetDrawItem_7602FC84)

	if tableHeroDrawSheetDrawItem != nil {
		for _, config := range tableHeroDrawSheetDrawItem {
			if summomType == config.Type { //根据类别 分组
				row := configpb.StcTableHeroDraw_SheetDrawItem_7602FC84{
					Id:     config.Id,
					Type:   config.Type,
					Itemid: config.Itemid,
					Name:   config.Name,
					Num:    config.Num,
					Weight: config.Weight,
				}
				allConfig[config.Id] = &row
			}
		}
	}
	return allConfig
}
